<template>
  <div id="photo">
    <div class="box">
      <ul class="smallbox">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
      </ul>
      <ul class="bigbox">
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {};
</script>

<style scoped lang="less">
#photo{
  position: relative;
  width: 400px;
  height: 400px;
}
.box {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #000;
  /* 在父类中设置视角 */
  perspective: 1000px;
  perspective-origin: 10% 50%;
}
.smallbox {
  position: relative;
  margin: 100px auto;
  width: 50px;
  height: 50px;
  /* 在动作元素中设置3D效果 */
  transform-style: preserve-3d;
  /* 绑定动画 时间 速度 动画时长类型 */
  animation: run 4s ease infinite;
}
.smallbox li {
  position: absolute;
  top: 50px;
  left: 50px;
  width: 50px;
  height: 50px;
  border: red solid 2px;
  list-style: none;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0.5;
}
.smallbox li:nth-child(1) {
  transform: translateY(-25px) rotateX(90deg);
  background-image: url("../3d/6.jpg");
}
.smallbox li:nth-child(2) {
  transform: translateY(25px) rotateX(90deg);
  background-image: url("../3d/7.jpg");
}
.smallbox li:nth-child(3) {
  transform: translateX(-25px) rotateY(90deg);
  background-image: url("../3d/8.jpg");
}
.smallbox li:nth-child(4) {
  transform: translateX(25px) rotateY(90deg);
  background-image: url("../3d/9.jpg");
}
.smallbox li:nth-child(5) {
  transform: translateZ(25px);
  background-image: url("../3d/4.jpg");
}
.smallbox li:nth-child(6) {
  transform: translateZ(-25px);
  background-image: url("../3d/5.jpg");
}
.bigbox {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  margin: auto;
  width: 200px;
  height: 200px;
  transform-style: preserve-3d;
  animation: run 8s ease infinite;
}
.bigbox li {
  position: absolute;
  top: 50px;
  left: 50px;
  width: 150px;
  height: 150px;
  border: greeen solid 2px;
  opacity: 0.5;
  background-size: cover;
  list-style: none;
}
.bigbox li:nth-child(1) {
  transform: translateY(-75px) rotateX(90deg);
  background-image: url("../3d/6.jpg");
}
.bigbox li:nth-child(2) {
  transform: translateY(75px) rotateX(90deg);
  background-image: url("../3d/7.jpg");
}
.bigbox li:nth-child(3) {
  transform: translateX(-75px) rotateY(90deg);
  background-image: url("../3d/8.jpg");
}
.bigbox li:nth-child(4) {
  transform: translateX(75px) rotateY(90deg);
  background-image: url("../3d/9.jpg");
}
.bigbox li:nth-child(5) {
  transform: translateZ(75px);
  background-image: url("../3d/4.jpg");
}
.bigbox li:nth-child(6) {
  transform: translateZ(-75px);
  background-image: url("../3d/5.jpg");
}
.bigbox:hover li:nth-child(1) {
  transform: translateY(-100px) rotateX(90deg);
  transition: transform 1s;
}
.bigbox:hover li:nth-child(2) {
  transform: translateY(100px) rotateX(90deg);
  opacity: 1;
  transition: transform 1s;
}
.bigbox:hover li:nth-child(3) {
  transform: translateX(-100px) rotateY(90deg);
  transition: transform 1s;
  opacity: 1;
}
.bigbox:hover li:nth-child(4) {
  transform: translateX(100px) rotateY(90deg);
  opacity: 1;
  /* 动画过渡时间 */
  transition: transform 1s;
}
.bigbox:hover li:nth-child(5) {
  transform: translateZ(100px);
  opacity: 1;
  transition: transform 1s;
}
.bigbox:hover li:nth-child(6) {
  transform: translateZ(-100px);
  opacity: 1;
  transition: transform 1s;
}
@keyframes run {
  0% {
    transform: rotateY(0deg);
  }
  25% {
    transform: rotateY(90deg);
  }
  50% {
    transform: rotateY(180deg);
  }
  75% {
    transform: rotateY(270deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}
</style>